home *** CD-ROM | disk | FTP | other *** search
/ A Guide to Multimedia / Ask Me Multimedia - A Guide to Multimedia Featuring Super Show and Tell (Ask Me Multimedia) (1994).ISO / matinee / matinee.ms_ / matinee.bin
Text File  |  1993-08-30  |  15KB  |  620 lines

  1. '$define debug
  2.  
  3. '$include 'setupapi.inc'
  4. '$include 'msdetect.inc'
  5.  
  6. ''Standard Dialog ID's : Make sure these are consistent with STDCUI.H file.
  7.  
  8. const WELCOME = 100
  9. const ASKQUIT = 200
  10. const DESTPATH = 300
  11. const EXITQUIT = 600
  12. const EXITSUCCESS = 700
  13.  
  14. ''Custom Dialog ID's : Make sure these are consistent with CUIDLG.H file.
  15.  
  16. const SELECTMODE = 6201
  17. const SELECTCHIP = 6202
  18. const SELECTSIZE = 6203
  19. const TOOBIG = 6204
  20. const SELECTCLIPS = 6205
  21.  
  22. '' Error IDs
  23.  
  24. const ERR_BADVGAMODE = 8000
  25. const ERR_BADCPU = 8001
  26. const ERR_BADWINDOWSPATH = 8002
  27. const ERR_BADPATH = 8003
  28.  
  29. ''Bitmap ID
  30.  
  31. const LOGO = 6101
  32.  
  33. ''Chip sets : Make sure these are consistent with the WhatVga DLL
  34.  
  35. const CIRRUS = 100
  36. const EVEREX = 101
  37. const PARADISE = 102
  38. const TSENG = 103
  39. const TRIDENT = 104
  40. const T8900 = 105
  41. const ATIVGA = 106
  42. const AHEADA = 107
  43. const AHEADB = 108
  44. const OAKTECH = 109
  45. const VIDEO7 = 110
  46. const CHIPSTECH = 111
  47. const TSENG4 = 112
  48. const GENOA = 113
  49. const NCR = 114
  50. const COMPAQ = 115
  51. const UNKNOWN = -1
  52.  
  53. ''User interface DLL name
  54.  
  55. const UIDll$ = "cui.dll"
  56.  
  57. ''Constants for functions
  58.  
  59. ''GetProcessor
  60.  
  61. const IS386 = 3
  62.  
  63. ''GetDeviceCaps
  64.  
  65. const NUMCOLORS = 24
  66. const SIZEPALETTE = 104
  67.  
  68. '' Global variable declaration
  69.  
  70. global MatineePath$     ''Default destination directory.
  71. global WindowsDir$      ''Windows directory.
  72. global MatineeIniPath$  ''Path to the INI file to be used
  73.  
  74. '' functions/procedure declaration
  75.  
  76. declare sub ConfirmQuit
  77. declare function MakePath (szDir$, szFile$) as string
  78. declare function GetColors() as integer
  79.  
  80. '' External function/procedure declaration
  81.  
  82. declare function GetDC lib "USER.EXE" (hwnd%) as integer 
  83. declare function ReleaseDC lib "USER.EXE" (hwnd%, hdc%) as integer
  84. declare function GetDeviceCaps lib "GDI.EXE" (hdc%, iCapabilities%) as integer
  85.  
  86. Init:   '' Start here
  87.  
  88.     '' Set up the error traps
  89.  
  90.     on error goto HandleError
  91.  
  92.     '' Set up the way the install program looks
  93.  
  94.     SetBitmap UIDll$, LOGO
  95.     SetTitle "Matinee version 1.0 Setup"
  96.  
  97.     '' Make sure proper hardware is there
  98.  
  99.     if GetProcessorType() < IS386 then
  100.  
  101.         '' We aren't on a 386 or above. FATAL!
  102.  
  103.         error ERR_BADCPU
  104.  
  105.     end if
  106.  
  107.     i% = GetColors()
  108.  
  109.     if i% <= 16 then
  110.  
  111.         '' make sure we didn't just wrap around...
  112.  
  113.         if i% >= 0 then
  114.  
  115.             '' We don't have a VGA driver with 256 colors
  116.             '' installed. FATAL!
  117.  
  118.             error ERR_BADVGAMODE
  119.  
  120.         end if
  121.  
  122.     end if
  123.  
  124.     '' Find the INF file
  125.  
  126.     szInfPath$ = GetSymbolValue("STF_SRCINFPATH")
  127.     if szInfPath$ = "" then
  128.         '' No predefined path for INF file, so just assume it is in
  129.         '' the current directory.
  130.  
  131.         szInfPath$ = GetSymbolValue("STF_CWDDIR") + "MATINEE.INF"
  132.     end if
  133.  
  134.     '' Load in the INF file
  135.  
  136.     ReadInfFile szInfPath$
  137.  
  138.     '' Set the size checking mode
  139.  
  140.     i% = SetSizeCheckMode(scmOnIgnore)
  141.  
  142.     '' Check that windows diectory is writable
  143.  
  144.     WindowsDir$ = GetWindowsDir()
  145.     i% = IsDirWritable(WindowsDir$)
  146.     if i% = 0 then
  147.  
  148.         '' Error: can't write to windows directory. exit.
  149.  
  150.         error ERR_BADWINDOWSPATH
  151.  
  152.     endif
  153.  
  154.     '' setup the ini path
  155.  
  156.     MatineeIniPath$ = MakePath(WindowsDir$, "CONTROL.INI")
  157.  
  158. DOWELCOME:
  159.  
  160.     sz$ = UIStartDlg(UIDll$, WELCOME, "FInfoDlgProc", 0, "")
  161.     if sz$ = "CONTINUE" then
  162.         UIPop 1
  163.     else
  164.         ConfirmQuit
  165.         goto DOWELCOME
  166.     end if
  167.  
  168.     '' Do the main thing
  169.  
  170. GETPATH:
  171.  
  172.     '' Set up symbols as parameters for dialog box
  173.  
  174.     SetSymbolValue "EditTextIn", "C:\MATINEE"
  175.     SetSymbolValue "EditFocus", "ALL"
  176.  
  177. GETPATHL1:
  178.  
  179.     sz$ = UIStartDlg(UIDll$, DESTPATH, "FEditDlgProc", 0, "")
  180.     MatineePath$ = GetSymbolValue("EditTextOut")
  181.  
  182.     if sz$ = "CONTINUE" then
  183.  
  184.         '' Make sure our target is writable
  185.  
  186.         if IsDirWritable(MatineePath$) = 0 then
  187.  
  188.             error ERR_BADPATH
  189.  
  190.             '' will resume here
  191.  
  192.             err = 0
  193.             goto GETPATHL1
  194.  
  195.         end if
  196.  
  197.         UIPop 1
  198.  
  199.     elseif sz$ = "REACTIVATE" then
  200.         goto GETPATHL1
  201.     else
  202.         ConfirmQuit
  203.         goto GETPATH
  204.     end if
  205.  
  206.     '' Set up the defaults before video DLL selection
  207.  
  208.     VgaType$ = "dib"
  209.     IsDIB$ = "1"
  210.  
  211.     '' select whether or not to set up chip sets
  212.  
  213. SELECTSETUPMODE:
  214.  
  215.     SetSymbolValue "RadioDefault", "1"
  216.  
  217. SELECTSETUPMODEL1:
  218.  
  219.     sz$ = UIStartDlg(UIDll$, SELECTMODE, "FRadioDlgProc", 0, "")
  220.     NewMode% = val(GetSymbolValue("ButtonChecked"))
  221.  
  222.     if sz$ = "CONTINUE" then
  223.  
  224.         UIPop 1
  225.  
  226.     elseif sz$ = "REACTIVATE" then 
  227.  
  228.         goto SELECTSETUPMODEL1
  229.  
  230.     elseif sz$ = "BACK" then 
  231.  
  232.         UIPop 1
  233.         goto GETPATH
  234.          
  235.     else
  236.  
  237.         ConfirmQuit
  238.         goto SELECTSETUPMODE
  239.  
  240.     end if
  241.  
  242.     select case NewMode%
  243.         case 2
  244.             '' Select Expert mode
  245.  
  246.             SetupMode% = 0
  247.  
  248.         case else
  249.             '' Select Normal mode
  250.  
  251.             SetupMode% = 1
  252.     end select
  253.  
  254.     if SetupMode% = 1 then
  255.     
  256.         goto SKIPCHIPSELECT
  257.  
  258.     end if
  259.  
  260.     '' Set up variables for chip select dialog
  261.  
  262.     VideoType = -1
  263.     Index$ = "6"
  264.  
  265. GETTYPE:
  266.  
  267.     '' select the chip type
  268.  
  269.     SetSymbolValue "RadioDefault", Index$
  270.  
  271. GETTYPEL1:
  272.  
  273.     sz$ = UIStartDlg(UIDll$, SELECTCHIP, "FRadioDlgProc", 0, "")
  274.     NewIndex% = val(GetSymbolValue("ButtonChecked"))
  275.  
  276.     if sz$ = "CONTINUE" then
  277.  
  278.         UIPop 1
  279.  
  280.     elseif sz$ = "REACTIVATE" then 
  281.  
  282.         goto GETTYPEL1
  283.  
  284.     elseif sz$ = "BACK" then 
  285.  
  286.         UIPop 1
  287.         goto SELECTSETUPMODE
  288.          
  289.     else
  290.  
  291.         ConfirmQuit
  292.         goto GETTYPE
  293.  
  294.     end if
  295.  
  296.     Index$ = str$(NewIndex%)
  297.  
  298.     select case NewIndex%
  299.         case 1
  300.             IsDIB$ = "0"
  301.             VgaType$ = "tsg"
  302.         case 2
  303.             IsDIB$ = "0"
  304.             VgaType$ = "tri"
  305.         case 3
  306.             IsDIB$ = "0"
  307.             VgaType$ = "v7"
  308.         case 4
  309.             IsDIB$ = "0"
  310.             VgaType$ = "cir"
  311.         case 5
  312.             IsDIB$ = "0"
  313.             VgaType$ = "cpq"
  314.         case else
  315.             IsDIB$ = "1"
  316.             VgaType$ = "dib"
  317.     end select
  318.  
  319. SKIPCHIPSELECT:
  320.  
  321.     '' Determine the speed of the machine. For the moment ignore this and
  322.     '' just use default for rate and simple size selection
  323.  
  324.     '' default for speed
  325.  
  326.     Rate$ = "30"
  327.  
  328.     '' select the size of the player
  329.  
  330.     if VgaType$ = "dib" then
  331.  
  332.         Size$ = "160"
  333.         Small$ = "1"
  334.         Index2$ = "2"
  335.  
  336.     else
  337.  
  338.         Size$ = "320"
  339.         Small$ = "0"
  340.         Index2$ = "1"
  341.  
  342.     end if
  343.  
  344. GETSIZE:
  345.  
  346.     SetSymbolValue "RadioDefault", Index2$
  347.  
  348. GETSIZEL1:
  349.  
  350.     sz$ = UIStartDlg(UIDll$, SELECTSIZE, "FRadioDlgProc", 0, "")
  351.     NewIndex% = val(GetSymbolValue("ButtonChecked"))
  352.  
  353.     if sz$ = "CONTINUE" then
  354.  
  355.         UIPop 1
  356.  
  357.     elseif sz$ = "REACTIVATE" then
  358.  
  359.         goto GETSIZEL1
  360.  
  361.     elseif sz$ = "BACK" then
  362.  
  363.         UIPop 1
  364.         if SetupMode% = 0 then
  365.             goto GETTYPE
  366.         else
  367.             goto SELECTSETUPMODE
  368.         end if
  369.     else
  370.  
  371.         ConfirmQuit
  372.         goto GETSIZE
  373.  
  374.     end if
  375.  
  376.     select case NewIndex%
  377.         case 1
  378.             Small$ = "0"
  379.             Size$ = "320"
  380.         case else
  381.             Small$ = "1"
  382.             Size$ = "160"
  383.     end select
  384.  
  385. STARTCOPYING:
  386.  
  387.     '' prepare directories
  388.  
  389.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  390.     CreateDir MatineePath$, cmoNone
  391.  
  392.     '' add the movies
  393.  
  394.     AddSectionFilesToCopyList "Movies", SrcDir$, MatineePath$
  395.  
  396.     '' Add standard files to the copy list
  397.  
  398.     AddSectionFilesToCopyList "Matinee", SrcDir$, MatineePath$
  399.     AddSectionFilesToCopyList "Background", SrcDir$, MakePath(MatineePath$, "backgrnd")
  400.     AddSectionFilesToCopyList "Windows", SrcDir$, WindowsDir$
  401.  
  402.     '' Complete the file selection process by adding the drivers.
  403.  
  404.     AddSectionKeyFileToCopyList "Drivers", Size$ + VgaType$, SrcDir$, WindowsDir$
  405.  
  406.     '' Determine if there is enough disk space for the installation.
  407.     '' DiskSp& will be > 0 if there is NOT enough space. It will be 0 if there
  408.     '' is sufficient free disk space for the installation
  409.  
  410.     SpaceCost& = GetCopyListCost(szExtra$,szCosts$, szNeeded$)
  411.  
  412.     '' Tell user how much more space is needed.
  413.  
  414.     if (SpaceCost& > 0) then
  415.         SpaceCostKB% = SpaceCost& / 1000
  416.         sz$ = str$(SpaceCostKB%)
  417.         SetSymbolValue "SpaceNeeded", sz$
  418.  
  419.         sz$ = UIStartDlg(UIDll$, TOOBIG, "FTooBigDlgProc", 0, "")
  420.  
  421.         UIPop 1
  422.         error STFQUIT
  423.     endif
  424.  
  425.     '' Copy the files
  426.  
  427.     CopyFilesInCopyList
  428.  
  429.     '' Set up the ini file
  430.  
  431.     CreateIniKeyValue MatineeIniPath$, "Screen Saver.Matinee", "MoviePath", MatineePath$, cmoOverwrite
  432.     CreateIniKeyValue MatineeIniPath$, "Screen Saver.Matinee", "ReelPath", MakePath(MatineePath$, "movie.lst"), cmoOverwrite
  433.     CreateIniKeyValue MatineeIniPath$, "Screen Saver.Matinee", "Rate", Rate$, cmoOverwrite
  434.     CreateIniKeyValue MatineeIniPath$, "Screen Saver.Matinee", "Small", Small$, cmoOverwrite
  435.     Creat